package br.com.websec.endereco;

import br.com.websec.util.DAOFactory;

public class EnderecoRN {
	
	private EnderecoDao enderecoDao;
	
	public EnderecoRN(){
		this.enderecoDao = DAOFactory.criaEnderecoDAO();
	}

	public void salvarEndereco(Endereco endereco) {
		Integer codigo = endereco.getIdEndereco();
		
		if (codigo == null || codigo == 0) {
			this.enderecoDao.salvar(endereco);
			
		}
	
	}
	
	public Endereco buscarPorCliente(Integer cliente){
		
		return this.enderecoDao.buscarPorCliente(cliente);
		
	}

}
